
package ch.hearc.coursJava.moo.thread.addition;


public class UseAdditionThread
	{

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	public static void main(String[] args)
		{
		main();
		}

	public static void main()
		{
		final int x = 5;
		final int y = 10;

		final IntegerAlterable resultat = new IntegerAlterable(0); // 0 ou n'importe quoi

		Runnable runnable = new Runnable()
			{

				@Override
				public void run()
					{
					resultat.set(x + y);
					}

			};

		Thread t1 = new Thread(runnable);
		t1.start();
		join(t1);
		System.out.println(resultat);

		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private static void join(Thread t)
		{
		try
			{
			t.join();
			}
		catch (InterruptedException e)
			{
			e.printStackTrace();
			}
		}

	}
